package cn.common.utils;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class PasswordHelper {
    private static String algorithmName = "MD5";
    private static int hashIterations = 2;

    /**
     * 加密任何字符串
     * <p> TODO</p>
     *
     * @author: Bat Admin
     * @param: @param pwd   字符串
     * @param: @param salt  盐值
     * @param: @return
     * @return: String
     * @throws:
     */
    public static String encryString(String pwd, String salt) {
        return new SimpleHash(
                algorithmName,
                pwd,
                ByteSource.Util.bytes(salt),
                hashIterations).toHex();
    }
}
